// HTML转字符串
export function htmlToEscape(sHtml: string) {
  const arrEntities = {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'} as {[key: string]: string};
  return sHtml.replace(/[<>&"]/g, (c: string) => arrEntities[c]);
}
// 转义字符串转 HTML
export function escapeToHtml(str: string) {
  const arrEntities = {'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'} as {[key: string]: string};
  return str.replace(/&(lt|gt|nbsp|amp|quot);/ig,(_all,t) => arrEntities[t]);
}